package goroutines

import "fmt"

func GoRoutine() {
	intChan := make(chan int, 10)

	for i := 0; i < 10; i++ {
		intChan <- i
	}
	close(intChan)

	for {
		i, ok := <-intChan
		fmt.Println(ok)
		if !ok {
			fmt.Println("channel is close.")
			return
		}
		fmt.Printf("当前在执行第%d个goroutine\n", i)
	}
}
